<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('duels', function (Blueprint $table) {
            $table->id();
            $table->timestamps();
            $table->softDeletes();
            //发起会员id
            $table->unsignedBigInteger('member_id');
            //对手会员id
            $table->unsignedBigInteger('opponent_id')->nullable();
            //发起会员微信号
            $table->string('member_wechat');
            //开始时间
            $table->dateTime('start_at');
            //假桌台类型
            $table->unsignedBigInteger('fake_table_type_id');
            //竞赛方式id
            $table->unsignedBigInteger('duel_type_id');
            //段位等级id
            $table->unsignedBigInteger('duel_level_id');
            //备注
            $table->string('remark')->nullable();
            //门店id
            $table->unsignedBigInteger('store_id');
            //状态
            $table->string('status')->default(\App\Enums\MiniAPP\DuelStatus::Pending);
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('duels');
    }
};
